<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html class="no-js">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>沃店</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">

    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>

    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/amazeui.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/app.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/index.css">

    <!--必要样式-->
    <style type="text/css">
        body {
            background-color: #EFEFEF;
        }

        .evaluate {
            padding: 30px 0;
        }

        .evaluatestar {
            float: right;
            line-height: 50px;
        }

        .evaluatestar img {
            margin-left: 10px;
        }

        .evaluate_content {
            margin-left: 70px;
            border-radius: 5px;
        }

        .evaluate_content textarea {
            width: 100%;
        }
    </style>
</head>

<body>
<header data-am-widget="header" class="am-header am-header-default am-header-fixed">
    <div class="am-header-left am-header-nav">
        <a href="${pageContext.request.contextPath}/clientHallOrder/detail?type=1&hallOrderId=${commentHallOrderId}"
           class="">
            <i class="am-header-icon am-icon-chevron-left"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        <a href="#title-link" class="">
            服务评价
        </a>
    </h1>
    <div class="am-header-right am-header-nav">
        <a href="${pageContext.request.contextPath}/clientHome/index" class="">
            <i class="am-header-icon am-icon-home"></i>
        </a>
    </div>
</header>
<div class="am-g whiteBg evaluate">
    <div class="am-u-sm-12">
        <img src="${user.avatar}"
             style="width:50px;height: 50px;border-radius: 100px;"><span
            style="line-height: 50px;margin-left: 20px;">服务评价</span>
        <span class="evaluatestar"><img src="${pageContext.request.contextPath}/images/star.png"><img
                src="${pageContext.request.contextPath}/images/star.png"><img
                src="${pageContext.request.contextPath}/images/star.png"><img
                src="${pageContext.request.contextPath}/images/star.png"><img
                src="${pageContext.request.contextPath}/images/star.png"></span>
    </div>
    <div class="am-u-sm-12">
        <div class="evaluate_content">
            <form class="am-form">
                <textarea id="comment" class="" rows="4" placeholder="亲，使用效果如何，对服务是否满意"></textarea>
            </form>
        </div>
    </div>
</div>
<div class="am-g" id="sub" align="center" style="margin-top: 100px;">
    <img src="${pageContext.request.contextPath}/images/comfirm_eval.png">
</div>

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="${pageContext.request.contextPath}/assets/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/amazeui.min.js"></script>
<script src="${pageContext.request.contextPath}/layer/layer.js"></script>
<script type="text/javascript">
    $(function () {
        var count = 0;
        $(".evaluatestar img").each(function (index) {
            $(this).click(function () {
                count = index + 1;
                $(".evaluatestar img").each(function (i) {
                    if (i <= index) {
                        $(this).attr('src', "${pageContext.request.contextPath}/images/star_light.png");
                    }
                    else {
                        $(this).attr('src', "${pageContext.request.contextPath}/images/star.png");
                    }
                });
            });
        });
        $("#sub").click(function () {
            if (count < 1) {
                alert("请选择星级");
                return;
            }
            $.ajax({
                type: "post",
                url: '${pageContext.request.contextPath}/clientOrgComment/comment',
                data: {
                    content: $('#comment').val(),
                    grade: count
                },
                dataType: 'json',
                success: function (data) {
                    if (data.success == true && data.code == 200) {
                        setInterval(function () {
                            window.location.href = "${pageContext.request.contextPath}/clientHallOrder/detail?type=1&hallOrderId=${commentHallOrderId}"
                        }, 2000);
                        layer.msg('评价成功,2秒后自动返回。');
                    }

                },
                error: function () {
                    layer.msg('网络超时');
                }

            });
        });
    });

</script>
</body>

</html>
